package com.gzsxy.esjy.feign.cart;


import com.gzsxy.esjy.feign.Product.ProductClientHystrix;
import com.gzsxy.esjy.feign.Product.ProductFallback;
import com.gzsxy.esjy.service.base.dto.response.DefaultResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;


//fallbackFactory是降级熔断工厂，异常统一进入对应的类
@FeignClient(value = "service-cart", fallbackFactory = CartFallback.class, fallback = CartClientHystrix.class)
public interface CartFeignService {

    /**
     * @param userId 商品id
     * @return
     * @description:  根据用户id查询当前购物车
     */
    @GetMapping(value = "/admin/cart/{userId}")
    public DefaultResponse getCartByUserId(@PathVariable String userId);

    /**
     * @param userId 商品id
     * @return
     * @description:  根据用户id删除当前购物车
     */
    @GetMapping(value = "/admin/cart/delete/{userId}")
    public DefaultResponse deleteByUserId(@PathVariable String userId);
}
